package com.fallsvc.order.controller;


import com.fallsvc.model.ProductInfo;
import com.fallsvc.order.api.ProductApi;
import com.fallsvc.order.model.OrderInfo;
import com.fallsvc.order.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @auther falls_vc
 * description:
 * @date 2025/5/25  11:05
 */
@Slf4j
@RequestMapping("/order")
@RestController
public class OrderController {
    @Autowired
    private OrderService orderService;

    @Autowired
    private ProductApi productApi;

    @RequestMapping("/{orderId}")
    public OrderInfo getOrderInfoById(@PathVariable("orderId")Integer orderId) {
        log.info("接收参数 orderId：{}",orderId);
        return orderService.selectOrderById(orderId);
    }
    @RequestMapping("/o1")
    public String o1(Integer id) {
        return productApi.p1(id);
    }
    @RequestMapping("/o2")
    public String o2(Integer id,String name) {
        return productApi.p2(id,name);
    }
    @RequestMapping("/o3")
    public String o3() {
        ProductInfo productInfo=new ProductInfo();
        productInfo.setId(1);
        productInfo.setProductName("T1");
        return productApi.p3(productInfo);
    }
    @RequestMapping("/o4")
    public String o4() {
        ProductInfo productInfo=new ProductInfo();
        productInfo.setId(12);
        productInfo.setProductName("T11");
        return productApi.p4(productInfo);
    }


}
